# koroFileHeader at Yungoal acer
# Create: 2022-06-29 14:53:42
# LastEdit: 2022-06-29 17:10:16
"""同步所有订阅和资源"""
__author__ = '749B'

import django
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ygmsp_dj.settings')
django.setup()


from django.contrib import admin
admin_site_obj = admin.AdminSite()


from resource.models import Auth, Subscriptions
from resource.admin import AuthAdmin, SubscriptionsAdmin

qs_auth = Auth.objects.all()
admin_auth = AuthAdmin(Auth, admin_site_obj)
admin_auth.message_user = lambda request, message, *arg, **kwargs: print(message)
admin_auth.get_subscriptions(None, qs_auth)

qs_sub = Subscriptions.objects.all()
admin_sub = SubscriptionsAdmin(Subscriptions, admin_site_obj)
admin_sub.message_user = lambda request, message, *arg, **kwargs: print(message)
admin_sub.get_resources(None, qs_sub)

